package com.zh.stargraph2.core.controller;

import com.zh.stargraph2.core.dto.common.Result;
import com.zh.stargraph2.core.dto.request.Text2ImageReqDto;
import com.zh.stargraph2.core.dto.respone.Text2ImageResDto;
import com.zh.stargraph2.core.service.Text2ImageService;
import com.zh.stargraph2.core.utils.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/authed/1.0/t2i")
public class TextToImageController {

    @Autowired
    private Text2ImageService text2ImageService;

    @PostMapping("/propmt")
    public Result<Text2ImageResDto> propmt(@RequestBody Text2ImageReqDto text2ImageReqDto) throws Exception {
        Text2ImageResDto text2ImageResDto = text2ImageService.prompt(text2ImageReqDto);
        return Result.ok(text2ImageResDto);
    }

    @PostMapping("/list")
    public String list() {
        System.out.println("用户ID是："+ UserUtils.getUser().getId());
        return "hello";
    }
}
